//取得地址的参数
!(function() {
  var getParameter = function(name) {
    var search = window.location.search.slice(1); //拿到浏览器的search 去掉问号
    var reg = new RegExp(name + "=(\\w+)", "gi"); // new RegExp  相当于// g:全局  i:不区分大小写
    var searchs = search.match(reg); //匹配字符串  ***=***
    if (searchs) {
      //如果存在
      return searchs[0].slice(name.length + 1);
    }
    return null;
  };

  var getParameter2 = function(index) {
    var search = window.location.pathname.slice(1);
    var searchs = search.split("/");
    if (index < searchs.length) {
      return searchs[index];
    }
    return null;
  };
  window.fi = {};
  window.fi.getParameter = getParameter;
  window.fi.getParameter2 = getParameter2;
})();
